package com.gnerv.battle.boot.project.guard.model.bo;

import com.gnerv.battle.boot.common.tools.DateTimeTools;
import com.gnerv.battle.boot.project.guard.model.entity.MonitorDatasource;
import lombok.Data;
import org.springframework.beans.BeanUtils;

@Data
public class MonitorDatasourceBO {

    private String ukId;
    private String name;
    private String type;
    private String config;
    private String template;
    private String status;
    private Integer sort;

    public MonitorDatasource toCreateMonitorDatasource(){
        MonitorDatasource monitorDatasource = new MonitorDatasource();
        BeanUtils.copyProperties(this, monitorDatasource);
        monitorDatasource.setGmtCreate(DateTimeTools.currentTimeMillis());
        monitorDatasource.setGmtModified(DateTimeTools.currentTimeMillis());
        return monitorDatasource;
    }

    public MonitorDatasource toUpdateMonitorDatasource(){
        MonitorDatasource monitorDatasource = new MonitorDatasource();
        BeanUtils.copyProperties(this, monitorDatasource);
        monitorDatasource.setGmtModified(DateTimeTools.currentTimeMillis());
        return monitorDatasource;
    }

}

